package com.epoint.mobileoa.personalized.epointcompany.bizlogic;

import java.util.HashMap;

import android.os.Message;

import com.epoint.mobileoa.R;
import com.epoint.mobileoa.bizlogic.SuperView;
import com.epoint.mobileoa.bizlogic.Task;
import com.epoint.mobileoa.tools.WebServiceUtilDAL;

/**
 * @author liyc
 * @time 2012-4-23 下午1:45:29
 * @annotation 
 */
public class BtnAddBaoxiaoDetailTask extends Task {

	public BtnAddBaoxiaoDetailTask(SuperView con, HashMap<String, Object> param) {
		super(con, param);
	}

	@Override
	public void exectue(Message mess) throws Exception {
		String url = getCon().getString(R.string.epointcompany_rizhi_url);
		String namespace = getCon().getString(R.string.epointcompany_rizhi_namespace);
		String method = "BtnAddBaoxiaoDetail";
		
		WebServiceUtilDAL webservice = new WebServiceUtilDAL(url,
				method, namespace);
		webservice.addProperty("RZRowGuid", getParam().get("RZRowGuid"));
		webservice.addProperty("RZDate", getParam().get("RZDate").toString().substring(0, 10));
		webservice.addProperty("UserGuid", getFP().getUserguid());
		webservice.addProperty("UserName", getFP().getDisplayname());
		webservice.addProperty("ChuChaiSJ", getParam().get("ChuChaiSJ"));
		webservice.addProperty("IsNeedWCMoney", getParam().get("IsNeedWCMoney"));
		webservice.addProperty("IsNeedZSMoney", getParam().get("IsNeedZSMoney"));
		webservice.addProperty("IsNeedBCAM", getParam().get("IsNeedBCAM"));
		webservice.addProperty("IsNeedBCPM", getParam().get("IsNeedBCPM"));
		webservice.addProperty("AMUserNames", getParam().get("AMUserNames"));
		webservice.addProperty("AMUserGuids", getParam().get("AMUserGuids"));
		webservice.addProperty("AMCustomers", getParam().get("AMCustomers"));
		webservice.addProperty("AMMoney", Long.valueOf(ec(getParam().get("AMMoney").toString())));
		webservice.addProperty("PMUserNames", getParam().get("PMUserNames"));
		webservice.addProperty("PMUserGuids", getParam().get("PMUserGuids"));
		webservice.addProperty("PMCustomers", getParam().get("PMCustomers"));
		webservice.addProperty("PMMoney", Long.valueOf(ec(getParam().get("PMMoney").toString())));
		String bs = webservice.start();
		setMessageToRefreshUI(mess, getCon(), bs);
	}

	public static String ec(String a){
		if(!a.contains(".")){
			return a;
		}
		else{
			int index = a.indexOf(".");
			return a.substring(0, index);
		}
	}
}
